package io.gitee.vexlife.snakeagentexample.astar;

import java.util.ArrayList;

import io.gitee.vexlife.snake.basic.Node;

public class AStarNode extends Node {

	private double f, g;
	private AStarNode parent;

	/**
	 * @param x
	 * @param y
	 * @param value 节点所对应的值
	 */
	public AStarNode(int x, int y, double f, double g) {
		super(x, y);
		this.f = f;
		this.g = g;
	}

	public AStarNode(Node sourceNode) {
		this(sourceNode.getX(), sourceNode.getY(),0,0);
	}

	/**
	 * @return 节点所对应的F
	 */
	public double getF() {
		return f;
	}

	/**
	 * @param f 待设置的节点所对应的F
	 */
	public void setF(double f) {
		this.f = f;
	}

	/**
	 * @return 节点所对应的G
	 */
	public double getG() {
		return g;
	}

	/**
	 * @param g 待设置的节点所对应的G
	 */
	public void setG(double g) {
		this.g = g;
	}

	public static AStarNode fromNode(Node sourceNode) {
		return new AStarNode(sourceNode);
	}

	public AStarNode getParent() {
		return parent;
	}

	public void setParent(AStarNode parent) {
		this.parent = parent;
	}
	
}